package abstractFactoryPattern;


import abstractFactoryPattern.factory.GuiFactory;
import abstractFactoryPattern.factory.MacFactory;
import abstractFactoryPattern.factory.WinFactory;
import org.junit.Test;

/**
 * @program: course
 * @author: lsn
 * @create: 2024-03-31 20:20
 * @description: 抽象工厂模式测试类
 */
public class ApiTest {

    @Test
    public void abstractFactoryPattern(){

        String os = "Mac";

        GuiFactory factory;
        if (os.equals("Windows")) {
            factory = new WinFactory();
        } else if (os.equals("Mac")) {
            factory = new MacFactory();
        } else {
            throw new RuntimeException("错误！未知的操作系统。");
        }
        Application app = new Application(factory);
        app.createUI();
    }
}

